package com.jmyd.coupon.server.domain.po;

import com.jmyd.commons.base.po.BaseSimpleStandardPo;
import com.jmyd.coupon.server.domain.dto.SceneActivityDto;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

/**
 * @author samphin
 * @since 2021/7/14 16:15
 */
@Data
@Table(name = "scene_activity")
public class SceneActivity extends BaseSimpleStandardPo<Long> implements Serializable {

    /**
     * 标题
     */
    @Column(name = "TITLE")
    private String title;

    /**
     * 活动图片地址
     */
    @Column(name = "IMAGE_URL")
    private String imageUrl;

    /**
     * 活动h5页面地址
     */
    @Column(name = "H5_PAGE_URL")
    private String h5PageUrl;

    /**
     * 优惠券ID
     */
    @Column(name = "COUPON_ID")
    private Long couponId;

    /**
     * 是否显示活动：true=显示;false=不显示
     */
    @Column(name = "VISIBLE")
    private Boolean visible;

    /**
     * 活动有效期起始时间
     */
    @Column(name = "VALID_START_TIME")
    private Date validStartTime;

    /**
     * 活动有效期结束时间
     */
    @Column(name = "VALID_END_TIME")
    private Date validEndTime;

    public SceneActivity build(SceneActivityDto dto) {
        BeanUtils.copyProperties(dto, this);
        return this;
    }
}